﻿@model Telerik.Web.Mvc.GridModel<LanguageModel>
@using Telerik.Web.Mvc.UI
@{
    //page title
    ViewBag.Title = @T("Admin.Configuration.Languages").Text;
}
<div class="section-header">
    <div class="title">
        <img src="@Url.Content("~/Administration/Content/images/ico-configuration.png")" alt="" />
        @T("Admin.Configuration.Languages")
    </div>
    <div class="options">
        <a href="@Url.Action("Create")" class="t-button">@T("Admin.Common.AddNew")</a>
    </div>
</div>
<table class="adminContent">
    <tr>
        <td>
            @(Html.Telerik().Grid<LanguageModel>()
                    .Name("languages-grid")
                    .BindTo(Model.Data)
                    .Columns(columns =>
                    {
                        columns.Bound(x => x.Name);
                        columns.Bound(x => x.LanguageCulture)
                            .Width(150)
                            .Centered();
                        columns.Template(
                                @<div>
                                    @Html.ActionLink(T("Admin.Configuration.Languages.Resources.View").Text, "Resources", new { languageId = @item.Id })
                                </div>
                            ).Width(200)
                            .Centered()
                            .Title(T("Admin.Configuration.Languages.Resources.View").Text);
                        columns.Bound(x => x.DisplayOrder)
                            .Width(100)
                            .Centered();
                        columns.Bound(x => x.Published)
                            .Width(100)
                            .Centered()
                            .Template(x => x.Published.ToString().ToLower());
                        columns.Bound(x => x.Id)
                            .Template(x => Html.ActionLink(T("Admin.Common.Edit").Text, "Edit", new { id = x.Id }))
                            .ClientTemplate("<a href=\"Edit/<#= Id #>\">" + T("Admin.Common.Edit").Text + "</a>")
                            .Width(50)
                            .Centered()
                            .HeaderTemplate(T("Admin.Common.Edit").Text)
                            .Filterable(false);
                    })
                    .DataBinding(dataBinding => dataBinding.Ajax().Select("List", "Language"))
                    .EnableCustomBinding(true))
        </td>
    </tr>
</table>